home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / pcw.zip / ATTR.C < prev    next >
Text File  |  1990-01-16  |  2KB  |  65 lines

  1. /**********************************************************/
  2. /* File Id.                  Attr.C                       */
  3. /* Author.                   Stan Milam.                  */
  4. /* Date Written.             06/03/89.                    */
  5. /*                                                        */
  6. /*         (c) Copyright 1989, 1990 by Stan Milam         */
  7. /*                                                        */
  8. /* Comments: Routines to get the color attributes & char- */
  9. /* acters at a specified row & column in the logical video*/
  10. /* page.                                                  */
  11. /**********************************************************/
  12.  
  13. #include <dos.h>
  14. #include "pcwproto.h"
  15. #ifdef MSC
  16. #   include <conio.h>
  17. #endif
  18.  
  19. static void sync_wait(void);
  20. extern int  CheckSnow;
  21.  
  22. int getattr(int row, int col) {
  23.  
  24.    int mxr, mxc;
  25.    unsigned  scrnseg;
  26.    int far *scrnptr;
  27.    int page, pagesize, offset;
  28.  
  29.    if (!chk_video_state(&mxr,&mxc)) return -1;
  30.    page     = getpage();
  31.    scrnseg  = getscrnseg();
  32.    pagesize = getpagesize();
  33.    offset   = MK_SCRNOFF(row,col);
  34.    scrnptr  = (int far *) MK_FP(scrnseg,offset);
  35.    if (CheckSnow) sync_wait();
  36.    return((*scrnptr & 0xff00) >> 8);
  37. }
  38.  
  39. int getchr(int row, int col) {
  40.  
  41.    int mxr, mxc;
  42.    unsigned  scrnseg;
  43.    int far *scrnptr;
  44.    int page, pagesize, offset;
  45.  
  46.    if (!chk_video_state(&mxr,&mxc)) return -1;
  47.    page     = getpage();
  48.    scrnseg  = getscrnseg();
  49.    pagesize = getpagesize();
  50.    offset   = MK_SCRNOFF(row,col);
  51.    scrnptr  = (int far *) MK_FP(scrnseg,offset);
  52.    if (CheckSnow) sync_wait();
  53.    return(*scrnptr & 0x00ff);
  54. }
  55.  
  56.  
  57. static void sync_wait(void) {
  58.  
  59.    while((inportb(0x3da) & 0x8) != 0);
  60.    while((inportb(0x3da) & 0x8) == 0);
  61. }
  62.  
  63.  
  64.  
  65.